<template>
  <view class="container">
	<web-view
	    id="webview"
	    :src="config.mapH5Url"
	    :webview-style="webviewStyle"
	    @onPostMessage="handleMessage"
	    @message="handleMessage"
	></web-view>
  </view>
</template>

<script lang="ts" setup>
import {ref,defineEmits} from 'vue'
import config from '@/utils/config'
const webviewStyle = ref({
  viewport:
    'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'
})

const emits = defineEmits(['getRoomList'])

const handleMessage = (val) => {
  console.log('*************-------------<<<<<<<', JSON.stringify(val))
  
  // 区分集中式分散式
  if(val.detail.data[0].isHasConcentrated==true){
	uni.navigateTo({
			url: `/pages/searchRoom/roomDetail?roomId=${val.detail.data[0].apartmentId}`,
		})
  }else{
	  uni.navigateTo({
	  		url: `/pages/searchRoom/mapSearchPopupH5?apartmentAreaId=${val.detail.data[0].roomAreaId}`,
	  	})
  }
  
}

</script>
